const Koa = require("koa");
const favicon = require("koa-favicon");
const serve = require('koa-static-server');
const path = require("path");
const { port } = require("./config");

const app = new Koa();

// 网站icon
app.use(favicon(path.join(__dirname, "public", "favicon.ico")));
app.use(serve({rootDir: './public', rootPath: '/'}));

app.on("error", function(error) {
  console.log(error);
});

app.listen(port, error => {
	if(error) throw error;
	else console.log(`server is running on: ${port};`);
});
